<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" class="username"/>
    <input type="text" class="password"/>
    <button class="btn">登录</button>

    <script>
        let username = document.querySelector('.username');
        let password = document.querySelector('.password');
        let btn = document.querySelector('.btn');

        btn.onclick = ()=>{
            fetch(`http://localhost:9999/api/login?username=${username.value}&password=${password.value}`)
            .then(res=>res.text())
            .then(res=>console.log(res))
            .catch(err=>console.log(err))
        }
    </script>
</body>
</html>